<?php
/*
|--------------------------------------------------------------------------
| Public Routes
|--------------------------------------------------------------------------
|
| 这里存放公共接口
|
*/

use App\Http\Controllers\Mini\BillController;
use Illuminate\Support\Facades\Route;

Route::namespace('Mini')->prefix('Mini')->group(function () {


    // 测试 -- 访问url  /api/Mini/test
    Route::get('test', 'PublicController@list');
    Route::post('split', 'SplitController@split_do');
    // 邻里圈路由
    Route::group(['prefix' => 'circle'], function () {
        //获取邻里圈列表
        Route::get('getCircle', 'CircleController@list');
        //获取邻里圈可用标签
        Route::get('getLabel', 'LabelController@list');
        //上传图片接口
        Route::post('uploadImg', 'LabelController@uploadImg');
        //发布邻里圈内容
        Route::post('addCircle', 'CircleController@add');
        //邻里圈内容详情
        Route::get('getCircle/{id}', 'CircleController@show')->where('id', '\d+');
        //删除我发布的邻里圈内容
        Route::get('delCircle/{id}', 'CircleController@delete')->where('id', '\d+');
        //获取邻里圈的评论
        Route::get('circleComment/{id}', 'CommentController@index')->where('id', '\d+');
        //评论邻里圈内容
        Route::post('circleComment', 'CommentController@store');
        //邻里圈动态点赞
        Route::get('like', 'CircleLikeController@like');
        //删除评论
        Route::delete('circleComment/{id}', 'CommentController@delete');
        //获取用户的通知
        Route::get('getNotice', 'CommentController@notice');
        //通知标记为已读
        Route::get('readNotice', 'CommentController@readNotice');

        //邻里圈 -- 租房
        Route::namespace('Circle')->prefix('house')->group(function () {
            Route::resource('lease', 'HouseController');
            Route::post('uploadImg', 'HouseController@uploadImg');
            Route::get('getHouseOption', 'HouseController@getHouseOption');

            Route::get('getOption', 'HouseController@getOption');
            //出售
            Route::resource('sell', 'HouseSellController');
            Route::post('uploadSellImg', 'HouseSellController@uploadImg');
        });

        //邻里圈跳蚤市场 -- 订单
        Route::namespace('Circle')->prefix('flea')->group(function () {
            Route::resource('order', 'FleaOrderController');
            //获取我买到的订单列表
            Route::get('myByOrder', 'FleaOrderController@myByOrder');
            //获取我卖出的订单列表
            Route::get('mySellOrder', 'FleaOrderController@mySellOrder');
            //获取我发布的商品列表
            Route::get('myGoods', 'FleaOrderController@myGoods');
            //收藏 / 取消收藏一个商品
            Route::post('collectionGoods', 'FleaCollectionGoodsController@collectionGoods');
            //我发布的信息统计
            Route::get('getMyDataCount', 'FleaCollectionGoodsController@getMyDataCount');
            //我的收藏列表
            Route::get('fleaCollection', 'FleaCollectionGoodsController@index');
            //我的消息通知列表
            Route::get('fleaNotice', 'FleaCollectionGoodsController@notice');
            //我未读的消息统计
            Route::get('getMyNotReadNotice', 'FleaCollectionGoodsController@getMyNotReadNotice');
            //标记为已读
            Route::get('readNotice', 'FleaCollectionGoodsController@readNotice');
            //删除通知
            Route::delete('destroyNotice/{id}', 'FleaCollectionGoodsController@destroyNotice')->where('id', '[0-9]+');
            //订单评论
            Route::resource('comment', 'FleaOrderCommentController');
            //我发布的所有评论
            Route::get('getMyComment', 'FleaOrderCommentController@getMyComment');
            //卖家回复评论
            Route::post('replyOrderComment', 'FleaOrderCommentController@replyOrderComment');
            //订单确认收货
            Route::post('orderComplete', 'FleaOrderController@orderComplete');
            //钱包控制器
            Route::resource('fleaWallet', 'FleaWalletController');
            //用户支出收入记录列表
            Route::get('recordList', 'FleaWalletController@recordList');
            //用户提现记录列表
            Route::get('withdrawalList', 'FleaWalletController@withdrawalList');

            //邻里圈商家的发布的商品
            Route::get('lssueGoods', 'FleaGoodsController@getLssueGoods');
            //邻里圈商家的评论列表
            Route::get('LssueGoodsComment', 'FleaGoodsController@getLssueGoodsComment');
            //用户简介
            Route::get('getUserIntro', 'FleaGoodsController@getUserIntro');
            //修改用户简介
            Route::post('upUserIntro', 'FleaGoodsController@upUserIntro');

            //拉取微信小程序支付
            Route::get('getPayConfig', 'FleaOrderController@getPayConfig');
        });
    });


    /*----------------------------------------------------------商城路由 start ---------------------------------*/
    // 商品路由
    Route::namespace('Shop')->prefix('goods')->group(function () {
        // 获取商品栏目
        Route::get('goodsClass', 'GoodsClassController@goodsClass');
        Route::post('goodsList', 'GoodsController@getGoodsList');
        Route::post('goodsInfo', 'GoodsController@getGoodsInfo');
        Route::get('goods_comments', 'GoodsController@goods_comments');
        Route::get('goods_comment_statistics', 'GoodsController@goods_comment_statistics');
    });

    // 店铺路由
    Route::namespace('Shop')->prefix('store')->group(function () {
        Route::get('StoreList', 'StoreController@index');                                            // 首页店铺列表
        Route::post('StoreInfo', 'StoreController@get_store_info');                              // 店铺首页
        Route::post('StoreGoodsList', 'StoreController@get_store_goods_list');                  // 店铺首页商品列表
        Route::get('StoreClass', 'StoresClassController@StoresClassList');
    });

    // 判断首页展示
    Route::namespace('Shop')->group(function () {
        Route::post('Index', 'IndexController@Index');
    });


    Route::group(['middleware' => 'jwt.user'], function () {
        // 用户地址路由
        Route::group(['prefix' => 'address'], function () {
            Route::post('getAddress', 'AddressController@getAddress');
            Route::post('add', 'AddressController@addAddress');
            Route::post('edit', 'AddressController@editAddress');
            Route::post('del', 'AddressController@delAddress');
            Route::post('set', 'AddressController@getSetDefault');
        });


        //订单路由
        Route::namespace('Shop')->prefix('order')->group(function () {
            Route::post('createOrder', 'OrderController@createOrder');
            Route::post('orderInfo', 'OrderController@orderInfo');
            Route::post('orderList', 'OrderController@orderList');
            Route::post('orderChangeStatus', 'OrderController@orderChangeStatus');
            Route::post('OrderChangeAddress', 'OrderController@OrderChangeAddress');

            Route::post('SumPrice', 'OrderController@SumPrice');
            //订单创建之前
            Route::post('create_order_before', 'OrderController@create_order_before');
            Route::post('delete', 'OrderController@delete');
            Route::post('pay', 'OrderController@Pay');
        });

        //售后路由
        Route::namespace('Shop')->prefix('refund')->group(function () {
            Route::post('addRefund', 'RefundController@addRefund')->name('addRefund');
            Route::post('refund_before', 'RefundController@refund_before')->name('refund_before');
            Route::post('refund_upload', 'RefundController@refund_upload')->name('refund_upload');
            Route::post('showRefund', 'RefundController@showRefund')->name('showRefund');
            Route::post('update', 'RefundController@update')->name('update');
            Route::post('getRefundCate', 'RefundController@getRefundCate')->name('getRefundCate');
            Route::post('clearRefund', 'RefundController@clearRefund')->name('clearRefund');
        });


        //订单评论
        Route::namespace('Shop')->prefix('comment')->group(function () {
            Route::post('store', 'OrderCommentController@store');
            Route::post('comment_upload', 'OrderCommentController@comment_upload');
        });

        // 购物车路由
        Route::namespace('Shop')->prefix('cart')->group(function () {
            Route::post('getCartList', 'CartController@getCartList');
            Route::post('addCart', 'CartController@addCart');
            Route::post('editCart', 'CartController@editCart');
            Route::post('delCart', 'CartController@delCart');
            Route::post('clearCart', 'CartController@clearCart');
            Route::post('cartChecked', 'CartController@cartChecked');
            Route::post('cartCount', 'CartController@cart_count');
        });

        //收藏路由
        Route::namespace('Shop')->prefix('favorites')->group(function () {
            Route::post('getFavoritesList', 'FavoritesController@getFavoritesList');
            Route::post('addFavorites', 'FavoritesController@addFavorites');
            Route::post('delFavorites', 'FavoritesController@delFavorites');
            Route::post('isFav', 'FavoritesController@isFav');
        });

        //反馈管理路由
        Route::namespace('Shop')->prefix('feedback')->group(function () {
            Route::post('catelist', 'FeedbackClassController@list');
            Route::post('addFeedback', 'FeedbackController@addFeedback');
            Route::post('feedback_upload', 'FeedbackController@feedback_upload');
        });

        //搜索热词
        Route::namespace('Shop')->prefix('keywords')->group(function () {
            Route::post('getList', 'KeywordsController@getList');
            Route::post('addKeyword', 'KeywordsController@addKeyword');
            Route::post('clearHistory', 'KeywordsController@clearHistory');
        });

        //消息通知路由
        Route::namespace('Shop')->prefix('notice')->group(function () {
            Route::post('getNoticeList', 'NoticeController@getNoticeList');
        });

        //积分路由
        Route::namespace('Shop')->prefix('integral')->group(function () {
            Route::post('getList', 'IntegralController@getList');
            Route::post('getInfo', 'IntegralController@getInfo');
        });

        //统计路由
        Route::namespace('Shop')->prefix('statistics')->group(function () {
            Route::post('UserStatistics', 'StatisticsController@UserStatistics');
        });

        /*------------------------------------------物业缴费路由 start-------------------------------------------------*/
        Route::group(['prefix' => 'bill'], function () {
            Route::post('getBillList', 'BillController@getBillList');//账单列表
            Route::post('bill_details', 'BillController@bill_details');//订单详情
            Route::post('costDetails', 'BillController@costDetails');//电费/水费
            Route::post('getPropertyBill', 'BillController@getPropertyBill');//物业费账单
            Route::post('preDepositDetail', 'BillController@preDepositDetail');//物业费预存明细
            Route::post('payBillList', 'BillController@payBillList');//缴费记录
            Route::post('getBillInfo', 'BillController@getBillInfo');//获取总账单 电费 水费 物业费
            Route::post('getBillDetail', 'BillController@getBillDetail');//获取缴费页面的信息
            Route::post('energyAnalysis', 'BillController@energyAnalysis');//能耗分析
            Route::post('property_log', 'PropertyController@property_log');//能耗分析
            /*------------------------------------------物业缴费路由 end-------------------------------------------------*/
        });
        Route::group(["prefix" => "property"], function () {
            Route::post("getPropertyPlanApi", "PropertyController@getPropertyPlanApi");//获取收费方案1,电费，2,水费，3，物业费
            Route::post("showPropertyApi", "PropertyController@showPropertyApi");//物业费缴费详细页面
            Route::post("settlementPropertyApi", "PropertyController@settlementPropertyApi");// 物业费结算
            Route::post("showSettlementDetailsApi", "PropertyController@showSettlementDetailsApi");//显示物业费缴纳详细
            Route::post("monthRadioCheckedApi", "PropertyController@monthRadioCheckedApi");//缴纳月份选中显示
            Route::post("getPlanDetail", "PropertyController@getPlanDetail");//获取计划详情
            Route::post("notice", "NoticeController@index");//公告列表
            Route::post("announcement", "AnnouncementController@index");//通知列表
            Route::get("notice_show/{id}", "NoticeController@show");//公告详情
            Route::get("my_balance", "UserController@my_balance");//公告详情
        });

        // 邻里圈--其他路由
        Route::group(['prefix' => 'other'], function () {
            Route::get('cateList/{type}', 'HouseCateController@catelist');
            Route::post('getInfoList', 'HouseCateController@getInfoList');
            Route::get('getInfoDetail/{type}/{id}', 'HouseCateController@getInfoDetail');
        });


        Route::post('getHouseCate', 'HouseCateController@catelist');
        Route::group(['prefix' => 'pay_order'], function () {
            Route::post('store', 'PaymentOrderController@store');
        });
    });
    /*----------------------------------------------------------商城路由 end ---------------------------------*/


    /**
     * 支付回调
     */
    Route::namespace('Shop')->prefix('order')->group(function () {
        Route::any('pay_notify', 'OrderController@pay_notify');
    });
});
